package net.sansi.v3correctserver.service.v3serverapi;

import com.dtflys.forest.annotation.*;
import net.sansi.v3correctserver.dto.correctresult.CorrectResultDto;
import net.sansi.v3correctserver.dto.v3serverapi.V3ServerCorrectDto;
import org.springframework.web.multipart.MultipartFile;

/**
 * v3-server 的 correct(亮度校正) api接口
 */
@BaseRequest(
        baseURL = "#{correct.v3-server.host}",
        interceptor = V3ServerApiInterceptor.class
)
public interface V3ServerCorrectApi {

    @Get("/correct/{screenId}/hardwarePreview/enable")
    V3ServerCorrectDto.HardwarePreviewEnable enableHardwarePreview(@Body("screenId") String screenId);

    @Put("/correct/{screenId}/hardwarePreview/display")
    V3ServerCorrectDto.HardwarePreviewResp displayHardwarePreview(@Body("screenId") String screenId,
                                                                  @JSONBody V3ServerCorrectDto.HardwarePreviewDisplayReq req);

    @Put("/correct/{screenId}/hardwarePreview/clear")
    V3ServerCorrectDto.HardwarePreviewResp clearHardwarePreview(@Body("screenId") String screenId);

    /**
     * CL 系数上传
     *
     * @param screenId 屏幕id
     * @param file     文件
     * @return 结果
     */
    @Put("/correct/{screenId}/cl/upload")
    V3ServerCorrectDto.UploadCLResp uploadClFile(@Body("screenId") String screenId,
                                                 @DataFile("file") MultipartFile file);

    /**
     * CL 文件升级开始
     *
     * @param screenId 屏幕id
     */
    @Post("/correct/{screenId}/cl/upgradeStart")
    void uploadClStart(@Body("screenId") String screenId);

    /**
     * CL 系数升级
     *
     * @param screenId 屏幕id
     * @return 结果
     */
    @Get("/correct/{screenId}/cl/upgradeProgress")
    V3ServerCorrectDto.UpgradeProgressResp getCLUpgradeProgress(@Body("screenId") String screenId);

    /**
     * CF 系数上传
     *
     * @param file CF 系数文件
     * @return 结果
     */
    @Put("/correct/cf/uploadZip")
    V3ServerCorrectDto.UploadCFResp uploadCFFile(@DataFile("file") MultipartFile file);

    /**
     * CL 文件升级开始
     *
     * @param screenId 屏幕id
     */
    @Post("/correct/{screenId}/cf/upgradeStart")
    void uploadCFStart(@Body("screenId") String screenId);

    /**
     * CF 系数升级
     *
     * @param screenId 屏幕id
     * @return 结果
     */
    @Get("/correct/{screenId}/cf/upgradeProgress")
    V3ServerCorrectDto.UpgradeProgressResp getCFUpgradeProgress(@Body("screenId") String screenId);

    /**
     * 系数固化开始
     *
     * @param screenId
     * @param req
     * @return 结果
     */
    @Post("/correct/{screenId}/data/solidify/start")
    V3ServerCorrectDto.SolidifyProgressResp solidifyStart(@Body("screenId") String screenId,
                                                          @JSONBody V3ServerCorrectDto.StartSolidifyFactorReq req);


    /**
     * 系数固化进度
     *
     * @param screenId
     * @return 结果
     */
    @Get("/correct/{screenId}/data/solidify/progress")
    V3ServerCorrectDto.SolidifyProgressResp getSolidifyProgress(@Body("screenId") String screenId);
}
